﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace MikroMagazaObject
{
    public partial class frmTarihFiltre : XtraForm
    {
        public ReportTypes RaporTipi { get; set; }
        public DateTime BaslangicTarihi { get; set; }
        public DateTime BitisTarihi { get; set; }

        public int BaslangicAy { get; set; }
        public int BitisAy { get; set; }

        public string Filtre { get; set; }

        public frmTarihFiltre()
        {
            InitializeComponent();
            xtraTabControl1.ShowTabHeader = DevExpress.Utils.DefaultBoolean.False;
        }

        private void frmTarihFiltre_Load(object sender, EventArgs e)
        {
            switch (RaporTipi)
            {
                case ReportTypes.GunlukSatisRaporu:
                    xtraTabControl1.SelectedTabPageIndex = 0;
                    break;
                case ReportTypes.AylikSatisRaporu:
                    xtraTabControl1.SelectedTabPageIndex = 1;
                    break;
                case ReportTypes.UrunSatisRaporu:
                    xtraTabControl1.SelectedTabPageIndex = 2;
                    break;
                default:
                    break;
            }
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            switch (xtraTabControl1.SelectedTabPageIndex)
            {
                case 0:
                    BaslangicTarihi = dteBaslangic1.DateTime;
                    BitisTarihi = dteBitis1.DateTime;
                    break;
                case 1:
                    BaslangicAy = Cevir.Parse<int>(txtBaslangic.Text);
                    BitisAy = Cevir.Parse<int>(txtBitis.Text);
                    break;
                case 2:
                    Filtre = txtStokAdi.Text;
                    BaslangicTarihi = dateEdit2.DateTime;
                    BitisTarihi = dateEdit1.DateTime;
                    break;
                default:
                    break;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}
